//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	ITemplateService.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

using System.Collections.Generic;

namespace Smart.Common.Templates
{
	/// <summary>
	/// Template service
	/// </summary>
	public interface ITemplateService
	{
		/// <summary>
		/// Template context
		/// </summary>
		TemplateCtx Ctx { get; set; }

		/// <summary>
		/// Current template Source (lazy)
		/// </summary>
		TemplateSource Source { get; set; }

		/// <summary>
		/// Current template Converter (lazy)
		/// </summary>
		TemplateConverter Converter { get; set; }

		/// <summary>
		/// Current template Formatter (lazy)
		/// </summary>
		TemplateFormatter Formatter { get; set; }

		/// <summary>
		/// Init service (also fills lazy properties)
		/// </summary>
		void InitService();

		/// <summary>
		/// Create template source
		/// </summary>
		TemplateSource CreateSource();

		/// <summary>
		/// Create template formatter
		/// </summary>
		TemplateConverter CreateConverter();

		/// <summary>
		/// Create template formatter
		/// </summary>
		TemplateFormatter CreateFormatter();

		/// <summary>
		/// Creates template context
		/// </summary>
		void InitContext(string serviceName);

		/// <summary>
		/// Create new template filter
		/// </summary>
		TemplateFilter CreateFilter();

		/// <summary>
		/// Return templates using filter
		/// </summary>
		IList<ITemplate> GetTemplates(TemplateFilter filter);

		/// <summary>
		/// Return templates using filter
		/// </summary>
		IList<TTemplateType> GetTemplates<TTemplateType>(TemplateFilter filter)
			where TTemplateType : class, ITemplate;

		/// <summary>
		/// Format template
		/// </summary>
		bool Format(string templateId, string instanceId, IDictionary<string, object> values);

		/// <summary>
		/// Format template
		/// </summary>
		bool Format(ITemplate template, ITemplateInstance instance, IDictionary<string, object> values);

		/// <summary>
		/// Format template
		/// </summary>
		object FormatData(string templateId, IDictionary<string, object> values);

		/// <summary>
		/// Format template
		/// </summary>
		object FormatData(object template, IDictionary<string, object> values);
	}
}